package cn.soarplus.web;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.ibase4j.core.base.BaseController;
import org.ibase4j.core.support.Assert;
import org.ibase4j.service.sys.SysAuthorizeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 用户登录
 * 
 * @author ShenHuaJie
 * @version 2016年5月20日 下午3:11:21
 */
@RestController
@Api(value = "设备管理", description = "设备管理")
@RequestMapping(value = "/device")
public class DeviceController extends BaseController {

    @Autowired
    private SysAuthorizeService authorizeService;

    // 设备列表
    @ApiOperation(value = "设备列表")
    @RequiresPermissions("iotp.device.read")
    @RequestMapping("/list")
    public Object list(ModelMap modelMap,
        @ApiParam(required = false, value = "设备编号") @RequestParam(value = "account", required = false) String account) {
        Assert.notNull(account, "ACCOUNT");

        List<String> list = authorizeService.queryPermissionByUserId(1L);
        return setSuccessModelMap(modelMap, list);
    }

}
